<template>
  <el-dialog title="详细信息" :visible.sync="dialogVisible" class="dialog">
    <el-descriptions v-if="info.id" direction="vertical" :column="2" border>

      <el-descriptions-item label="产品名称">{{ info.name }}</el-descriptions-item>
      <el-descriptions-item label="产品类型">{{ info.type == 'limit_number' ? '限购份数' : '限购金额' }}</el-descriptions-item>
      <el-descriptions-item label="产品id">{{ info.id }}</el-descriptions-item>

      <el-descriptions-item label="产品封面">
        <el-image style="width: 100px; height: 100px" :src="info.cover" :preview-src-list="[info.cover]" />
      </el-descriptions-item>
      <el-descriptions-item label="利息">{{ info.interest }}</el-descriptions-item>
      <el-descriptions-item label="利息发放周期">{{ info.interestCycle }}</el-descriptions-item>
      <el-descriptions-item label="是否新手产品">{{ info.isRookiePro == '1' ? '是' : '否' }}</el-descriptions-item>
      <el-descriptions-item label="定期时长">{{ info.lockDays }}</el-descriptions-item>
      <el-descriptions-item label="是否上架">{{ info.status == '1' ? '上架' : '下架' }}</el-descriptions-item>
      <el-descriptions-item label="排序">{{ info.sort }}</el-descriptions-item>

      <el-descriptions-item v-if="info.limitNumber" label="限购金额">{{ info.limitNumber.amount }}</el-descriptions-item>

      <el-descriptions-item v-if="info.limitNumber" label="限购总份数">{{ info.limitNumber.sumLimitNumber }}</el-descriptions-item>

      <el-descriptions-item v-if="info.limitNumber" label="每人限购份数">{{ info.limitNumber.userLimitNumber }}</el-descriptions-item>
      <el-descriptions-item v-if="info.limitMoney" label="最高金额">{{ info.limitMoney.maxAmount }}</el-descriptions-item>
      <el-descriptions-item v-if="info.limitMoney" label="最低金额">{{ info.limitMoney.minAmount }}</el-descriptions-item>
      <el-descriptions-item v-if="info.limitMoney" label="总限购金额">{{ info.limitMoney.sumLimitMoney }}</el-descriptions-item>

    </el-descriptions>

    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">取 消</el-button>
      <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
    </span>
  </el-dialog>
</template>
<script>
import { _isMobile } from '@/utils/index'
export default {
  data() {
    return {
      dialogVisible: false,
      info: {},
      isMobile: _isMobile
    }
  },

  methods: {
    show(e) {
      console.log(e)
      this.dialogVisible = true
      this.info = e
    }
  }
}
</script>
